$(function () {
});
var ad = new Vue({
        el: '#answerDetail',
        data() {
            var data = $.urlToJson();
            return {
                audio_id: data.id,
                lcid: 0,
                MainForm: { //主流程列表数据
                    Intents: [
                        {
                            keword_id: 0,
                            intent_name: '',
                            content: ''
                        }
                    ]
                }
            }
        },
        watch: {
        },
        computed: {
            uploadUrl() {
                return `${api_config.baseUrl}/FileServer/Index/${this.id}`;
            }
        },
        methods: {
            handleMouseleave(index, val) {
                //鼠标移出
                if (!this.sonOver) {
                    this.navSet = "";
                }
                //console.log('一级菜单鼠标移出', this.sonOver, this.navNum);
            },
            handleMouseenter(index, val) {
                //鼠标移入
                this.navNum = index;
                this.navSet = 'navDetail' + index;
                //console.log('一级菜单鼠标移入2', this.sonOver, this.navNum);
            },
            //验证上传的文件的格式
            beforeAvatarUpload(file) {
                //文件最大只能上传50M文件
                if (file.size > 50 * 1024 * 1024) {
                    this.$message.error('上传文件最大只能上传50M文件!');
                    return false;
                }
                var audioIndex = file.name.lastIndexOf(".");
                var audioType = file.name.substring(audioIndex + 1, audioIndex.length);
                if (audioType === 'wav') {
                    return file;
                } else {
                    this.$message.error('上传文件只能是 wav 格式!');
                    return false;
                }
            },
            //开启或者关闭ul
            classOpen(index) {
                if ($(".scene" + index).hasClass('open')) {
                    $(".scene" + index).removeClass('open');
                } else {
                    $(".open").removeClass('open');
                    $(".scene" + index).addClass('open');
                }
            }
        },
        mounted() {
            $("#answerDetail").css("display", "block");
        }
    });